package com.hainatong.jcmvvmbase.mainhome.adapter;

import com.chad.library.adapter.base.provider.BaseItemProvider;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.hainatong.jcmvvmbase.R;
import com.hainatong.jcmvvmbase.databinding.ItemSysMsgViewBinding;
import com.hainatong.jcmvvmbase.mainhome.entity.SysMsgBean;
import com.hainatong.mvvmbase.base.BaseBean;
import org.jetbrains.annotations.NotNull;

public class SysMsgProvider extends BaseItemProvider<BaseBean>
{


    @Override
    public int getItemViewType()
    {
        return SysMsgItemType.MSG_VIEW;
    }

    @Override
    public int getLayoutId()
    {
        return R.layout.item_sys_msg_view;
    }

    @Override
    public void convert(@NotNull BaseViewHolder baseViewHolder, BaseBean baseBean)
    {
        ItemSysMsgViewBinding binding = baseViewHolder.getBinding();
        if( baseBean == null )
        {
            return;
        }
        if( binding != null )
        {
            binding.tvMsgTitle.setText( ((SysMsgBean) baseBean).getName() );
            binding.tvContent.setText( ((SysMsgBean) baseBean).getName() );
            binding.tvNotifyTime.setText( ((SysMsgBean) baseBean).getTime() );
            binding.tvLocation.setText( ((SysMsgBean) baseBean).getLocation() );
            //binding.setSysMsg();
            //binding.executePendingBindings();
        }
    }
}
